package com.dems.core.util;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * @author liuyq
 * */
public class CalculateUtil {
    private static final float MILLEN_STEP = 60000;
    private static final BigDecimal MILLEN_STEP_BIGDECIMAL = BigDecimal.valueOf(60000);
    public static long millenToMinute(long startTime, long endTime){
         float value = (endTime - startTime)/MILLEN_STEP;
          return (long) Math.ceil(value);
    }


    public static long millenToMinute(long timestamp) {
        return BigDecimal.valueOf(timestamp).divide(MILLEN_STEP_BIGDECIMAL, RoundingMode.HALF_UP).longValue();
    }
}
